from ronglian_sms_sdk import SmsSDK
from celery_task.create_celery import celery_app
import json

accId = "8aaf07087f77bf96017fddfc0c323402"
accToken = "2effd547b7b04fc3a713f5cf75fa303c"
appId = "8aaf07087f77bf96017fddfc0d293409"


@celery_app.task()
def sms_code(sms,mobile,expire=20):
    tid = '1'
    datas = ('%s'%sms,'%s'%expire)
    rest = SmsSDK(accId,accToken,appId).sendMessage(tid,mobile,datas)

    if json.loads(rest)['statusCode'] == '000000' or json.loads(rest)['statusCode'] == '112310':
        return True
    else:
        return False


